<style scoped>
.steps-wrapper {
  display: flex;
  justify-content: center; /* 水平居中 */
  /* 如果需要垂直居中（在这个例子中不需要），可以添加 align-items: center; */
  /* 注意：通常不需要为 .steps-wrapper 设置高度，因为它会根据其内容自动调整 */
}
.custom-steps {
  width: calc(100% - 500px);
}
</style>
<template>
  <div>
    <el-card>
      <!-- <div class="steps-wrapper">
        <el-steps :active="active" finish-status="success" class="custom-steps">
          <el-step title="按照订单分配"></el-step>
          <el-step title="配货对象"></el-step>
        </el-steps>
      </div> -->
      <div slot="header">
        <span style="font-size: large"> 按异常单分配</span>
        <span style="font-weight: 600">
          (分配规则说明：可选中单条异常记录单或者多条异常记录单，按退货比例从高到低进行分配)</span
        >
      </div>

      <I v-show="active == 0" @next="next" />
      <II :row="row" v-show="active == 1" @prev="prev" @next="submit" />
    </el-card>
    <!-- <el-button style="margin-top: 12px" @click="pre">上一步</el-button>
    <el-button style="margin-top: 12px" @click="next">下一步</el-button> -->
  </div>
</template>

<script>
import {
  getShopReturnNumAndAndCalc,
  getShopReturnNumAndAndCalcList,
} from "@/api/productAllocation/BiProductReturnRestock";
import I from "./listByOrder.vue";
import II from "./II";
// import III from "./III";
// import IV from "./IV";
// import V from "./V";
// import VI from "./VI";
export default {
  components: { I, II },
  data() {
    return {
      row: [],
      active: 0,
      queryParams: {},
      // span: 1,
    };
  },
  created() {
    // console.log(JSON.stringify(this.$route.query.obj));
    if (this.$route.query.obj) {
      this.queryParams = this.$route.query.obj;
      console.log(JSON.stringify(this.queryParams));
      // this.getList();
    }

    // this.provincearr = province
  },
  methods: {
    submit() {
      this.$emit("colselistByOrder");
    },
    // spanChange(val) {},
    next(shelfIds) {
      if (shelfIds.length == 0) {
        this.$modal.msgError("请至少选择一条数据");
        return;
      }
      // if (this.active++ > 2) this.active = 0;
      //   this.shelfIds = shelfIds
      // this.queryParams = {
      //   allocType: "ByOrder",
      //   shelfId: shelfIds[0].shelfId,
      //   productStockCount: shelfIds[0].productStockCount,
      //   productType: shelfIds[0].productType,
      // };
      let count = 0;
      count++;
      shelfIds.forEach((element) => {
        element.count = count;
      });

      this.row = shelfIds;
      // getShopReturnNumAndAndCalcList(shelfIds).then((response) => {
      //   this.row = response;
      // });
      this.active++;
    },
    prev() {
      // if (this.active-- == 0) return;
      this.active--;
    },
  },
};
</script>

